<nav class="navbar" id="header-navbar">
    <script type="text/javascript">
        new Vue({
            el: '#header-navbar',
            data: {userName: $.cookie("userName")}
        });
    </script>
    <div class="container-fluid">
        <div class="navbar-header" style="padding-left: 15px;">
            <a class="navbar-brand" href="/courseCategorys">
                <img src="/img/logo.png" height="30px;" />
            </a>
        </div>
        <div class="pull-left" style="padding: 5px 0 5px 0">
            <ul class="nav navbar-nav">
                <li><a href='/courseCategorys'>课程学习</a></li>
                <li><a href='/examples'>实例教程</a></li>
                <li><a href='/examples'>作品展示</a></li>
                <li><a href='/tests'>在线测试</a></li>
            </ul>
        </div>
        <div class="pull-right" style="padding: 5px 15px 5px 0">
            <form class="navbar-form navbar-left" id="searchForm">
                <div class="input-group" style="width: 200px;">
                    <input type="text" class="form-control" placeholder="Search" id="keyword">
                    <span class="input-group-btn">
                    <button class="btn btn-default" type="submit">
                        <span class="glyphicon glyphicon-search"></span>
                    </button>
                    </span>
                </div>
            </form>
            <ul class="nav navbar-nav">
                <li v-show="userName === undefined">
                    <a href="login.html"><span class="glyphicon glyphicon-log-in"></span> 登录</a>
                </li>
                <li v-show="userName === undefined">
                    <a href="register.html"><span class="glyphicon glyphicon-user"></span> 注册</a>
                </li>
                <li v-show="userName !== undefined">
                    <a href="#" v-text="userName"></a>
                </li>
            </ul>
        </div>
    </div>
</nav>
<script type="text/javascript">
$(function() {
	$("#searchForm").submit(function() {
		$.cookie("keyword", $("#keyword").val(), {path:'/'});
		setTimeout("window.location.href = '/resources';", 500);
		return false;
	});
});
</script>
